package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.TransferTabBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class TransferTabAdapter extends StkProviderMultiAdapter<TransferTabBean> {

    public TransferTabAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(76));
        addItemProvider(new TransferTabProvider());
    }

    private class TransferTabProvider extends BaseItemProvider<TransferTabBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_transfer_tab;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, TransferTabBean bean) {
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivTransferTabItemImg, bean.getSelImg());
            } else {
                baseViewHolder.setImageResource(R.id.ivTransferTabItemImg, bean.getImg());
            }
        }
    }

}
